<?php
//Class que Gere os Envios de SMS de modo manual
require_once 'C:/wSys/PHP/PEAR/SOAP/Client.php';
$wsdl_url 		= 'https://smsexpress.tmn.pt/smsexpress-webservices/SubmissionManager2?wsdl';
$WSDL     		= new SOAP_WSDL($wsdl_url);

//Config
$app_name 		= 'SMS';

//Obtem a mensagem gravada
if(!empty($_GET['id'])){
$le = "SELECT csm_Text FROM systemoffice.contact_savedmsg WHERE csm_ID = '".$_GET['id']."'";
$msg_resultado 	= mysql_query($le);
$reg 			= mysql_fetch_array($msg_resultado);
$sms_send_text	= $reg["csm_Text"];
}else{
$sms_send_text = $_SESSION['Text'];
}

//Obtem os numeros de telemovel
$take_num = explode(',',substr($_POST['list'],1,strlen($_POST['list'])-1));
foreach ($take_num as $sms_send_mobile_number) {
//Script de envio
$client = $WSDL->getProxy();
//Verifica/Activa os certificados SSL
$client->setOpt('curl', CURLOPT_VERBOSE, 1);
$client->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
$client->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);

	$params1 = array ('application' => $app_name,
			'username' => '12132021',
			'password' => 'rXrkMxFE');

	$params2 = array ('message' => $sms_send_text,'recipients' => $sms_send_mobile_number,'sender' => 'MONEYEXPRES','validity' => 24);

//Envia a mensagem
$client->sendSmsSubmission($params1,$params2);
 }
 $send_message = "<img src='Modules/CMX3458E/icons/action_check.gif'/> Mensagem de SMS enviada com sucesso.";







